//
//  PhotoListCellTableViewCell.m
//  ChatForHot
//
//  Created by wr on 2018/10/15.
//  Copyright © 2018年 FLY. All rights reserved.
//

#import "PhotoListCellTableViewCell.h"

@implementation PhotoListCellTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self HOTCHATdidInitialized];
    }
    return self;
}

- (void)HOTCHATdidInitialized {
    [self.contentView addSubview:self.HOTCHATphotoImgView];
    [self.contentView addSubview:self.HOTCHATnameLab];
    [self.contentView addSubview:self.HOTCHATnumLab];
    [self.contentView addSubview:self.HOTCHATlineview];
    
    [self.HOTCHATphotoImgView mas_updateConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self).offset(10);
        make.left.equalTo(self).offset(10);
        make.width.height.mas_equalTo(75);
    }];
    [self.HOTCHATnameLab mas_updateConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self).offset(25);
        make.left.equalTo(self.HOTCHATphotoImgView.mas_right).offset(15);
        make.right.lessThanOrEqualTo(self).offset(-15);
    }];
    [self.HOTCHATnumLab mas_updateConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self).offset(-25);
        make.left.equalTo(self.HOTCHATphotoImgView.mas_right).offset(15);
        make.right.lessThanOrEqualTo(self).offset(-15);
    }];
    [self.HOTCHATlineview mas_updateConstraints:^(MASConstraintMaker *make) {
        make.left.bottom.right.equalTo(self);
        make.height.mas_equalTo(0.5);
    }];
}

- (void)setModel:(HCAlbumModel *)model{
    _model = model;
    self.HOTCHATphotoImgView.image = model.coverImage;
    self.HOTCHATnameLab.text = model.name;
    self.HOTCHATnumLab.text = [NSString stringWithFormat:@"%zd",model.count];
}

- (UIImageView *)HOTCHATphotoImgView{
    if (_HOTCHATphotoImgView == nil) {
        _HOTCHATphotoImgView = [[UIImageView alloc] init];
        _HOTCHATphotoImgView.clipsToBounds = YES;
        _HOTCHATphotoImgView.contentMode = UIViewContentModeScaleAspectFill;
        _HOTCHATphotoImgView.layer.cornerRadius = 2;
    }
    return _HOTCHATphotoImgView;
}

- (UILabel *)HOTCHATnameLab{
    if (_HOTCHATnameLab == nil) {
        _HOTCHATnameLab = [[UILabel alloc] init];
        _HOTCHATnameLab.font = [UIFont systemFontOfSize:15];
        _HOTCHATnameLab.textColor = [UIColor colorFromHexString:@"1A1A1A"];
    }
    return _HOTCHATnameLab;
}

- (UILabel *)HOTCHATnumLab{
    if (_HOTCHATnumLab == nil) {
        _HOTCHATnumLab = [[UILabel alloc] init];
        _HOTCHATnumLab.font = [UIFont systemFontOfSize:12];
        _HOTCHATnumLab.textColor = [UIColor colorFromHexString:@"808080"];
    }
    return _HOTCHATnumLab;
}
- (UIView *)HOTCHATlineview{
    if (_HOTCHATlineview == nil) {
        _HOTCHATlineview = [[UIView alloc] init];
        _HOTCHATlineview.backgroundColor = [UIColor colorFromHexString:@"EDEDED"];
    }
    return _HOTCHATlineview;
}

@end
